﻿/*Page created by Mike Beck -- this page dynamically edits the data that populates the MyHealthSnapshop page*/

using System;
using Microsoft.Practices.ObjectBuilder;
using Common;

namespace CSC440TeamOne.MyHealth.Views
{
	public partial class MyHealthSnapshot : Microsoft.Practices.CompositeWeb.Web.UI.Page, IMyHealthSnapshotView
	{
		private MyHealthSnapshotPresenter _presenter;

		protected void Page_Load(object sender, EventArgs e)
		{
			if (!this.IsPostBack)
			{
				this._presenter.OnViewInitialized();
			}
			this._presenter.OnViewLoaded();
		}

		[CreateNew]
		public MyHealthSnapshotPresenter Presenter
		{
			get
			{
				return this._presenter;
			}
			set
			{
				if(value == null)
					throw new ArgumentNullException("value");

				this._presenter = value;
				this._presenter.View = this;
			}
		}

		// TODO: Forward events to the presenter and show state to the user.
		// For examples of this, see the View-Presenter (with Application Controller) QuickStart:
		//	


        public void show(MyHealthSnapshotModel Model)
        {
            this.systolicVal.Text = Model.systolic.Value +"";
            this.systolicName.Text = Model.systolic.Name;
            this.systolicRating.Text = Model.systolic.status;
            this.systolicRating.CssClass = Model.systolic.status;

            this.diastolicVal.Text = Model.diastolic.Value + "";
            this.diastolicName.Text = Model.diastolic.Name;
            this.diastolicRating.Text = Model.diastolic.status;
            this.diastolicRating.CssClass = Model.diastolic.status;

            this.waistVal.Text = Model.waist.Value + "";
            this.waistName.Text = Model.waist.Name;
            this.waistRating.Text = Model.waist.status;
            this.waistRating.CssClass = Model.waist.status;

            this.BMIVal.Text = Model.bmi.Value + "";
            this.BMIName.Text = Model.bmi.Name;
            this.BMIRating.Text = Model.bmi.status;
            this.BMIRating.CssClass = Model.bmi.status;

            this.cholesterolVal.Text = Model.cholesterol.Value + "";
            this.cholesterolName.Text = Model.cholesterol.Name;
            this.cholesterolRating.Text = Model.cholesterol.status;
            this.cholesterolRating.CssClass = Model.cholesterol.status;

            this.glucoseVal.Text = Model.glucose.Value + "";
            this.glucoseName.Text = Model.glucose.Name;
            this.glucoseRating.Text = Model.glucose.status;
            this.glucoseRating.CssClass = Model.glucose.status;

            this.activityVal.Text = Model.physicalActivity.Value + " days per week";
            this.activityName.Text = Model.physicalActivity.Name;
            this.activityRating.Text = Model.physicalActivity.status;
            this.activityRating.CssClass = Model.physicalActivity.status;

            this.restingHeartVal.Text = Model.restingHeart.Value + "";
            this.restingHeartName.Text = Model.restingHeart.Name;
            this.restingHeartRating.Text = Model.restingHeart.status;
            this.restingHeartRating.CssClass = Model.restingHeart.status;
            

        }
    }
}

